package com.mzpai.util.generate;

/**
 * 
 * <b>根据PO生成Service类</b><br>
 * 
 * yanglijun 2012-11-9 下午3:45:32
 * 
 * @version 1.0.0
 * 
 */
public class GenerateService<T> extends GenerateBase<T> {

  public static final String PACKAGE_TYPE = "service";

  public GenerateService(Class<T> clazz, String moduleName, String author) {
    super(clazz, PACKAGE_TYPE, moduleName, author);
  }

  @Override
  protected void generaeImport() {
    addImport(CLAZZ_NAME, false);
    addImport("com.mzpai.service.BaseService", false);
  }

  @Override
  protected void generaeCalssTitle() {
    StringBuffer sb = new StringBuffer("public interface ");
    sb.append(clazz.getSimpleName());
    sb.append(SUFFIX); 
    sb.append(" extends BaseService<");
    sb.append(clazz.getSimpleName());
    sb.append("> {");
    sb.append(NEXT_LINE);
    addClassLine(sb.toString());
  }

  @Override
  protected void generaeCalssContext() {
    //  删除 
	StringBuffer sb = new StringBuffer("").append(NEXT_LINE);
//	sb.append("	/** ").append(NEXT_LINE);
//	sb.append("	*").append(NEXT_LINE);
//	sb.append("	* 删除 ").append(NEXT_LINE);
//	sb.append("	* @param id").append(NEXT_LINE);
//	sb.append("	*/").append(NEXT_LINE);
//	sb.append("	public int delete(String id) throws Exception;");
//	sb.append(NEXT_LINE);
//	sb.append(NEXT_LINE);
//	
//	sb.append("	/** ").append(NEXT_LINE);
//	sb.append("	*").append(NEXT_LINE);
//	sb.append("	* 保存 ").append(NEXT_LINE);
//	sb.append("	* @param target").append(NEXT_LINE);
//	sb.append("	*/").append(NEXT_LINE);
//	sb.append("	public int save(").append(clazz.getSimpleName()).append(" target) throws Exception;");
//	sb.append(NEXT_LINE);
//	sb.append(NEXT_LINE);
//	
//	sb.append("	/** ").append(NEXT_LINE);
//	sb.append("	*").append(NEXT_LINE);
//	sb.append("	* 修改 ").append(NEXT_LINE);
//	sb.append("	* @param target").append(NEXT_LINE);
//	sb.append("	*/").append(NEXT_LINE);
//	sb.append("	public int update(").append(clazz.getSimpleName()).append(" target) throws Exception;");
//	sb.append(NEXT_LINE);
//	sb.append(NEXT_LINE);
//	
//	
//	
//	sb.append("	/** ").append(NEXT_LINE);
//	sb.append("	*").append(NEXT_LINE);
//	sb.append("	* 查询 ").append(NEXT_LINE);
//	sb.append("	* @param map").append(NEXT_LINE);
//	sb.append("	* @return").append(NEXT_LINE);
//	sb.append("	*/").append(NEXT_LINE);
//	sb.append("	public PageInfo<").append(clazz.getSimpleName()).append("> getList(Map<String, Object> map, Integer pageNum, Integer pageSize) throws Exception;");
//	sb.append(NEXT_LINE);
//	sb.append(NEXT_LINE);
//	
//	
//	sb.append("	/** ").append(NEXT_LINE);
//	sb.append("	*").append(NEXT_LINE);
//	sb.append("	*  根据ID，查询信息 ").append(NEXT_LINE);
//	sb.append("	* @param id").append(NEXT_LINE);
//	sb.append("	* @return").append(NEXT_LINE);
//	sb.append("	*/").append(NEXT_LINE);
//	sb.append("	public ").append(clazz.getSimpleName()).append(" queryById(String id) throws Exception;");
//	sb.append(NEXT_LINE);
//	sb.append(NEXT_LINE);
//	
//	
//	sb.append("	/** ").append(NEXT_LINE);
//	sb.append("	*").append(NEXT_LINE);
//	sb.append("	*  查询所有数据 ").append(NEXT_LINE);
//	sb.append("	* @param id").append(NEXT_LINE);
//	sb.append("	* @return").append(NEXT_LINE);
//	sb.append("	*/").append(NEXT_LINE);
//	sb.append("	public List<").append(clazz.getSimpleName()).append("> getList(Map<String, Object> map) throws Exception;");
//	sb.append(NEXT_LINE);
//	sb.append(NEXT_LINE);
	
	 addClassLine(sb.toString());
  }

}
